<?php require __DIR__ . '/../inc_header.tpl.php';?>

<span class="layui-breadcrumb">
	<a href="<?php echo url(['platform','platform','index']);?>">控制台</a>
	<a><cite>管理员</cite></a>
</span>

<div class="layui-tab layui-tab-brief">
  <ul class="layui-tab-title">
	<li class="layui-this"><a class="layui-this" href="<?php echo url(['platform','admin','index']);?>">用户管理</a></li>
  </ul>
</div>    

<div class="layui-form toolbar">
	<div class="layui-form-item">
		<div class="layui-inline">
			<a href="<?php echo url(['platform','admin','admin_add']);?>" class="layui-btn">
				<i class="layui-icon layui-icon-add-1"></i>新增
			</a>
		</div>
        <div class="layui-inline" style="float:right">
             <form action="<?php echo url(['platform','admin','index']);?>" method="get">
             <input type="hidden" name="<?php echo $GLOBALS['config']['var_pathinfo']; ?>" value="<?php echo $_REQUEST[ $GLOBALS['config']['var_pathinfo'] ]; ?>">
                <label class="layui-form-label w-auto"> &nbsp; </label>
                <div class="layui-input-inline mr0">
                    <input name="keyword" value="<?php echo isset($_REQUEST['keyword'])?$_REQUEST['keyword']:'';?>" class="layui-input" type="text" placeholder="输入名称关键字"  lay-verify="required" />
                </div>
                <button class="layui-btn icon-btn" lay-filter="formSubSearchTbBas" lay-submit type="submit">
                    <i class="layui-icon">&#xe615;</i>搜索
                </button>
            </form>
        </div>
	</div>
</div>

<table class="layui-table" id="tableTbBas" lay-filter="tableTbBas">
	<thead>
		<tr>
			<th>ID</th>
			<th>管理员名称</th>
			<th>管理员账号</th>
			<th>最后登录时间</th>
			<th>最后登录ip</th>
			<th>登录次数</th>
			<th>状态</th>
			<th>操作</th>
		</tr> 
	</thead>
	<tbody>
		<?php
		foreach($rs as $row){
		?>
		<tr>
			<td ><?php echo $row['admin_id'];?></td>
			<td ><?php echo $row['name'];?></td>
			<td ><?php echo $row['login_account'];?></td>
			<td ><?php echo date('Y-m-d H:i:s',$row['last_login_time'] );?></td>
			<td ><?php echo $row['last_login_ip'];?></td>
			<td ><?php echo $row['login_count'];?></td>
			<td ><?php if($row['status']==1){ ?><span class="layui-btn layui-btn-xs">启用</span><?php }else{ ?><span class="layui-btn layui-btn-xs  layui-btn-primary">禁用</span><?php } ?></td>
			<td >
				<a href="<?php echo url(['platform','admin','password_form'],['id'=>$row['admin_id']]);?>"><button class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon layui-icon-password"></i>密码</button></a>
				<a href="<?php echo url(['platform','admin','admin_edit'],['id'=>$row['admin_id']]);?>"><button class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon layui-icon-edit"></i>修改</button></a>
				<?php
				if( $row['admin_id']==1 || $row['admin_id']== $_SESSION['platform']['admin']['admin_id'] ){
				?>
					<button class="layui-btn layui-btn-disabled layui-btn-sm"><i class="layui-icon layui-icon-delete"></i>删除</button>
				<?php
				}else{
					?>
					<a href="<?php echo url(['platform','admin','admin_delete'],['id'=>$row['admin_id']]);?>" onclick="return rj_confirm('你确定删除么？', this.href );"><button class="layui-btn layui-btn-danger layui-btn-sm"><i class="layui-icon layui-icon-delete"></i>删除</button></a>
					<?php
				}
				?>
			</td>
		</tr>
		<?php
		}
		?>
	</tbody>
</table>
<div class="layui-box layui-laypage layui-laypage-default" style="display:block;text-align:center;margin-top:10px">
	<?php echo $page->url_nav_easy();?>
</div>

<?php require __DIR__ . '/../inc_footer.tpl.php';?>